<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\BaseRequest  as Base;

class AdminRequest extends Base
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, mixed>
     */
    public function rules()
    {
        /*return [
            //
        ];*/
        switch ($this->routeName){
            case 'admin.home.doChange':
              return [
               'old_password' => 'required|min:6|max:20',
                'password' => 'required|min:6|max:20',
                 'confirm_password' => 'required|min:6|max:20'
              ];
            break;

        }
    }

    public  function  messages()
    {
       switch ($this->routeName){
           case 'admin.home.doChange':
           return [
            'old_password.required' => '旧密码是必填项',
             'old_password.min' => '旧密码最少6个字符',
             'old_password.max' => '旧密码最多20个字符',
             'password.required' =>'新密码是必填项',
              'password.min' => '新密码最少6个字符',
              'password.max' => '新密码最多20个字符',
              'confirm_password.required' => '确认密码是必填项',
               'confirm_password.min' => '确认密码最少6个字符',
               'confirm_password.max' => '确认密码最多20个字符'
           ];
           break;
       }
    }
}
